<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta
			name="viewport"
			content="width=device-width, initial-scale=1, maximum-scale=1"
		/>
		<title><%= title %></title>
		<meta name="renderer" content="webkit" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta
			name="viewport"
			content="width=device-width, initial-scale=1, maximum-scale=1"
		/>
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="format-detection" content="telephone=no" />

		<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="/layui/css/login.css" media="all" />
	</head>
	<body class="layui-layout-body">
		<div
			class="layadmin-user-login layadmin-user-display-show"
			id="LAY-user-login"
			style="display: none;"
		>
			<div class="layadmin-user-login-main">
				<div class="layadmin-user-login-box layadmin-user-login-header">
					<h2>维纳搜索后台</h2>
					<p></p>
				</div>
				<div
					class="layadmin-user-login-box layadmin-user-login-body layui-form"
				>
					<div class="layui-form-item">
						<label
							class="layadmin-user-login-icon layui-icon layui-icon-username"
							for="LAY-user-login-username"
						></label>
						<input
							type="text"
							name="username"
							id="LAY-user-login-username"
							lay-verify="required"
							placeholder="用户名"
							class="layui-input"
						/>
					</div>
					<div class="layui-form-item">
						<label
							class="layadmin-user-login-icon layui-icon layui-icon-password"
							for="LAY-user-login-password"
						></label>
						<input
							type="password"
							name="password"
							id="LAY-user-login-password"
							lay-verify="required"
							placeholder="密码"
							class="layui-input"
						/>
					</div>

					<div class="layui-form-item">
						<button
							class="layui-btn layui-btn-fluid"
							lay-submit
							lay-filter="LAY-user-login-submit"
						>
							登 入
						</button>
					</div>
				</div>
			</div>

			<div class="layui-trans layadmin-user-login-footer">
				<p>
					© 2020
					<a href="/" target="_blank">维纳搜索</a>
				</p>
			</div>
		</div>
		<script src="/layui/layui.js" charset="utf-8"></script>
		<script>
			//JavaScript代码区域
			layui.use(["form"], function() {
				var $ = layui.$,
					form = layui.form;

				form.render();

				//提交
				form.on("submit(LAY-user-login-submit)", function(obj) {
					$.ajax({
						type: "post",
						url: "/admin/login",
						data: obj.field,
						success: function(responseTxt) {
							if (responseTxt.code == 0) {
								//登入成功的提示与跳转
								layer.msg(
									responseTxt.msg,
									{
										offset: "15px",
										icon: 1,
										time: 1000
									},
									function() {
										location.href = responseTxt.url; //后台主页
									}
								);
							} else {
								layer.msg(responseTxt.msg);
							}
						}
					});
				});
			});
		</script>
	</body>
</html>
